#ifndef GAME_H
#define GAME_H

#include <QMainWindow>
#include<QPushButton>
#include<QLabel>
#include<QButtonGroup>
#include <QRadioButton>
#include<QPushButton>
#include<bits/stdc++.h>
#include<QPoint>
#include<QString>
#include<QPaintEvent>
#include<QPainter>
#include<QBrush>
#include<QPen>
#include<QMessageBox>
#include<QMouseEvent>
#include<QApplication>
#include<QWidget>
#include<QDebug>
#include<QPalette>
#include<QtDebug>
#include<QLabel>
using namespace std;

namespace Ui {
class Game;
}

class Game : public QMainWindow
{
    Q_OBJECT

public:
    explicit Game(QWidget *parent = 0);
    ~Game();
    void paintEvent(QPaintEvent *e);//绘图
    void win(int x,int y);//是否有某一方赢、
    int iswin(QPoint p);
    int getpoint(QPoint p,int direction,int offset);
    QPoint m_direction[8]={
        QPoint(0,-1),QPoint(1,-1),QPoint(1,0),QPoint(1,1),
        QPoint(0,1),QPoint(-1,1),QPoint(-1,0),QPoint(-1,-1)
    };//方向
    void mouseMoveEvent(QMouseEvent *e);
    void mousePressEvent(QMouseEvent *e);
    void persontime(QMouseEvent *e);
    void AI_time();
    void updatechessboard(int x,int y);
    int assess(QPoint now,int m);

private:
    Ui::Game *ui;
    int type;//游戏模式
    QButtonGroup *select;
    int flag;//游戏按钮
    QPushButton *button;
    int player;//玩家
    int move1,move2;//鼠标位置
    int current1,current2;//落子位置
    bool lock;
    stack<QPoint>sta;
    int chessboard[15][15];
    QString winner=0;

public slots:
    void selectradio();
    void open();
    void back();
};

#endif // GAME_H
